package com.sky.com.sky.mapper;


import com.sky.annotation.AutoFill;
import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface CategoryMapper {

    List<Category> list(CategoryDTO categoryDTO);

    @AutoFill("insert")
    void insert(Category category);

    // 根据id删除
    @Delete("delete from category where id=#{id}")
    void deleteById(Long id);

    //更新
    @AutoFill("update")
    void update(Category category);

    // 条件查询
    List<Category> getList(CategoryPageQueryDTO categoryPageQueryDTO);

    // 根据名称查询
    @Select("select * from category where name=#{name}")
    Category getByName(String name);

    @Select("select * from category where status = #{status}")
    List<Category> getListByStatus(Integer status);


}